package com.wing.cabinet.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 权限管理表
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("cab_authority_manage")
public class AuthorityManage extends BaseEntity<AuthorityManage> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum CreditWay implements IEnum<Integer> {

        /**
        * 组员共享领用金额
        */
        share(0,"组员共享领用金额"),
        /**
        * 组员独立授信领用金额
        */
        independent(1,"组员独立授信领用金额"),
        /**
        * 不限制领用金额
        */
        unlimited(2,"不限制领用金额"),
        /**
         * 组员共享领用数量
         */
        shareQuantity(3,"组员共享领用数量"),
        /**
         * 组员独立授信领用数量
         */
        independentQuantity(4,"组员独立授信领用数量"),
        /**
         * 不限制领用数量
         */
        unlimitedQuantity(5,"不限制领用数量");

        private int code;
        private String desc;

        CreditWay(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum LineEvaluatePeriod implements IEnum<Integer> {

        /**
        * 每天
        */
        day(0,"每天"),
        /**
        * 每周
        */
        week(1,"每周"),
        /**
        * 每月
        */
        month(2,"每月"),
        /**
        * 每季度
        */
        quarter(3,"每季度"),
        /**
        * 每年
        */
        year(4,"每年");

        private int code;
        private String desc;

        LineEvaluatePeriod(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum AstrictMaterial implements IEnum<Integer> {

        /**
        * 不限制
        */
        noAstrict(0,"不限制"),
        /**
        * 限制
        */
        astrict(1,"限制");

        private int code;
        private String desc;

        AstrictMaterial(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum CreditType implements IEnum<Integer> {
        /**
         * 金额
         */
        money(0,"金额"),
        /**
         * 数量
         */
        quantity(1,"数量");

        private int code;
        private String desc;

        CreditType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 权限组名称
     */
    private String name;

    /**
     * 授信方式
     */
    private CreditWay creditWay;

    /**
    * 授信方式描述
    */
    @TableField(exist = false)
    private String creditWayDesc;

    public String getCreditWayDesc() {
        return creditWay == null ? null : creditWay.getDesc();
    }

    /**
     * 授信额度
     */
    private BigDecimal lineOfCredit;

    /**
     * 授信类型
     */
    private CreditType creditType;

    /**
    * 授信类型描述
    */
    @TableField(exist = false)
    private String creditTypeDesc;

    public String getCreditTypeDesc() {
        return creditType == null ? null : creditType.getDesc();
    }

    /**
     * 是否限制物料
     */
    private AstrictMaterial astrictMaterial;

    /**
    * 是否限制物料描述
    */
    @TableField(exist = false)
    private String astrictMaterialDesc;

    public String getAstrictMaterialDesc() {
        return astrictMaterial == null ? null : astrictMaterial.getDesc();
    }

    /**
     * 额度评估周期
     */
    private LineEvaluatePeriod lineEvaluatePeriod;

    /**
     * 额度评估周期描述
     */
    @TableField(exist = false)
    private String lineEvaluatePeriodDesc;

    public String getLineEvaluatePeriodDesc() {
        return lineEvaluatePeriod == null ? null : lineEvaluatePeriod.getDesc();
    }

    /**
     * 可领物资分类id
     */
    private String materialId;

    /**
     * 可领物资分类名
     */
    private String materialName;

    /**
     * 刀具柜Id
     */
    private String cabinetId;

    /**
     * 状态  0正常  1停用
     */
    private Long status;

    /**
     * 刀具柜编码
     */
    private String cabinetCode;

    /**
     * 单个物料默认限制阈值(金额/数量)
     */
    private Integer authorizedQuantity;

    public enum RestrictWay implements IEnum<Integer> {
        /**
         * 按分类
         */
        category(0,"按分类"),
        /**
         * 按物料
         */
        materiel(1,"按物料");

        private int code;
        private String desc;

        RestrictWay(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }
    /**
     * 限制方式
     */
    private RestrictWay restrictWay;

    /**
     * 限制方式描述
     */
    @TableField(exist = false)
    private String restrictWayDesc;

    public String getRestrictWayDesc() {
        return restrictWay == null ? null : restrictWay.getDesc();
    }

    /**
     * 数量未归还阈值
     */
    private Integer quantityThreshold;
    /**
     * 金额未归还阈值
     */
    private BigDecimal moneyThreshold;
    /**
     * 实际授信额度
     */
    private BigDecimal practicalLineOfCredit;

    /**
     * 超额预警审核人
     */
    private Long excessAuditor;

    /**
     * 领用复审额度
     */
    private BigDecimal recheckAmount;

    /**
     * 复审额度审核人
     */
    private Long recheckAmountAuditor;

    /**
     * 超额预警是否开启 0开启 1关闭
     */
    private Integer excessStatus;

    /**
     * 整体授信数量
     */
    private Integer creditQuantity;

    /**
     * 整体授信金额
     */
    private BigDecimal creditAmount;

    /**
     * 实际授信数量
     */
    private Integer practicalCreditQuantity;

    /**
     * 单个物料默认限制状态: 0 限制  1不限制
     */
    private Integer authotizedStatus;

}
